// 请求数据格式转化
// json => string
// { id:1, name: 2 } => ?id=1&name=2
export const transFormValue = (obj) => {
    const arr = []
    Object.keys(obj).forEach(function (key) {
      if (typeof obj[key] === 'object') {
        if (obj[key] == null) {
          arr.push(`${key}=`)
        } else {
          if (obj[key] == 'object') {
            obj[key] = obj[key].map(item => JSON.stringify(item)).join(',')
          }
          arr.push(`${key}=${JSON.stringify(obj[key])}`)
        }
      } else {
        arr.push(`${key}=${obj[key]}`)
      }
    })
    return '?' + arr.join('&')
  }

  //导出xlsx文件
export const exportFile = (data, fileName) => {
  let blob = new Blob([data],{type: data.type})
  var downloadElement=document.createElement('a');
  var href=window.URL.createObjectURL(blob);
  downloadElement.href=href;
  downloadElement.download=fileName;
  document.body.appendChild(downloadElement);
  downloadElement.click();
  window.URL.revokeObjectURL(href);
}